﻿package net.jmp0.toast.entities.menu 
{
	import flash.geom.ColorTransform;
	import net.jmp0.toast.entities.effects.GameText;
	import punk.Acrobat;
	import punk.core.Spritemap;
	import punk.Textplus;
	
	/**
	 * ...
	 * @author Thodd
	 */
	public class TitleText extends Acrobat
	{
		
		[Embed(source = '../../res/toast.png')] private var imgToast:Class;
		private var sprToast:Spritemap = FP.getSprite(imgToast, 20, 20);
		
		//Marker sprites
		[Embed(source = '../../res/marker/marker_yellow.png')] private var imgYellowMarker:Class;
		private var sprYellowMarker:Spritemap = FP.getSprite(imgYellowMarker, 172, 83, false, false, 0, 0, false);
		
		private var title:GameText = new GameText("Monsieur Toast", 200, 20, "kraboudja", 36, -300, true);
		private var subtitle:GameText = new GameText("subtitle", 100, 60, "garbage", 21, -300, true);
		
		public function TitleText() {
			//setting the textcolor
			title.color = 0x800000;
			title.align = "center";
			FP.world.add(title);
			
			subtitle.text = "or: How I Witnessed Some Rather Strange Happenings at the Diner.\r(Author's Note: No, not at Winkie's.)\n\r";
			subtitle.color = 0x263466;
			subtitle.align = "center";
			FP.world.add(subtitle);
			
			//Setting the animation speed and the alphavalue of the underlaying marker
			this.delay = (30 / 4);			
			var ct:ColorTransform = new ColorTransform();
			ct.alphaMultiplier = 0.5;
			sprYellowMarker.colorTransform(sprYellowMarker.rect, ct);
		}
		
		override public function render():void {
			updateImage(sprToast.number);
			drawSprite(sprYellowMarker, 0, 175, 25, false, false);
			drawSprite(sprYellowMarker, 0, 310, 25, false, false);
			drawSprite(sprToast, image, 170+title.getShakeX(), 33+title.getShakeY(), false, false);
			drawSprite(sprToast, image, 445+title.getShakeX(), 33+title.getShakeY(), false, false);
		}
		
	}

}